import cv2
import os
import random
import matplotlib.pyplot as plt
def display_image(path):
    filelist=os.listdir(path)
    image=[]
    for i in range(10):
        t=random.randint(0,len(filelist)-1)
        image.append(path+'/'+filelist[t])
    i = 1
    for img_path in image:
        plt.subplot(2,, 5, i)
        img = cv2.imread(img_path)
        plt.imshow(img)
        plt.axis('off')
        i = i + 1
    plt.show()
SRC_PATH='C:/Users/Administrator/PycharmProjects/untitled/Resources/data/'
filelist=os.listdir(SRC_PATH)
print("{}文件夹中共有{}个文件!".format(SRC_PATH,len(filelist)))
display_image(SRC_PATH)
DST1_PATH='C:/Users/Administrator/PycharmProjects/untitled/Resources/resized_data/'
if not os.path.exists(DST1_PATH):
    os.makedirs(DST1_PATH)
DST2_PATH='C:/Users/Administrator/PycharmProjects/untitled/Resources/fliped_data/'
if not os.path.exists(DST2_PATH):
    os.makedirs(DST2_PATH)